/**
 * 
 */
package org.istt.aop;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;

/**
 * @author Huy
 *
 */
@Aspect
public class DaoLoggingAspect {
	private final Log log = LogFactory.getLog(getClass());
	
	@Around("execution(* org.istt.dao.*.*(..))")
	  public Object doBasicProfiling(ProceedingJoinPoint pjp) throws Throwable {
		// start log
		if (log.isDebugEnabled()) {
			log.debug("Starting function " + pjp.getSignature().getName() + " in the class " + pjp.getTarget().getClass().getName());
		}
	    
	    Object retVal = pjp.proceed();
		
		if (log.isDebugEnabled()) {
			log.debug("Ending function " + pjp.getSignature().getName() + " in the class " + pjp.getTarget().getClass().getName());
		}
		// end log
	    return retVal;
	  }
}
